]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
appMenu: Allow showing the window section for all windows
authorFlorian Müllner <fmuellner@gnome.org>
Thu, 12 Aug 2021 19:25:49 +0000 (21:25 +0200)
committerMarge Bot <marge-bot@gnome.org>
Mon, 16 Aug 2021 21:28:22 +0000 (21:28 +0000)
Since commit fd0da9606fd2, we only show the "Open Windows" section
if there are at least two windows. That's another subtle difference
with the overview context menus, but while limiting the section to
a minimum of two windows makes sense where the menu always represents
a running app, it is useful to show the section even for single windows
in the dash/app grid.

Account for both uses cases by adding a corresponding option to the
constructor.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1948>

js/ui/appMenu.js

index 3c363bf9cc5ef89d617907329b3562d7990e48c1..afd04d4b8f0d97f8d8debbc8c87ca1a47ae5c415 100644 (file)
@@ -9,8 +9,10 @@ var AppMenu = class AppMenu extends PopupMenu.PopupMenu {
     /**
      * @param {Clutter.Actor} sourceActor - actor the menu is attached to
      * @param {St.Side} side - arrow side
+     * @param {object} params - options
+     * @param {bool} params.showSingleWindow - show window section for a single window
      */
-    constructor(sourceActor, side = St.Side.TOP) {
+    constructor(sourceActor, side = St.Side.TOP, params = {}) {
         if (Clutter.get_default_text_direction() === Clutter.TextDirection.RTL) {
             if (side === St.Side.LEFT)
                 side = St.Side.RIGHT;
@@ -22,8 +24,13 @@ var AppMenu = class AppMenu extends PopupMenu.PopupMenu {
 
         this.actor.add_style_class_name('app-menu');
 
+        const {
+            showSingleWindows = false,
+        } = params;
+
         this._app = null;
         this._appSystem = Shell.AppSystem.get_default();
+        this._showSingleWindows = showSingleWindows;
 
         this._windowsChangedId = 0;
         this._updateWindowsLaterId = 0;
@@ -166,8 +173,9 @@ var AppMenu = class AppMenu extends PopupMenu.PopupMenu {
         if (!this._app)
             return;
 
+        const minWindows = this._showSingleWindows ? 1 : 2;
         const windows = this._app.get_windows().filter(w => !w.skip_taskbar);
-        if (windows.length < 2)
+        if (windows.length < minWindows)
             return;
 
         this._openWindowsHeader.show();